package com.ruoyi.ly.mapper;

import com.github.pagehelper.Page;
import com.ruoyi.ly.domain.SpaceSiteGroup;
import com.ruoyi.ly.domain.dto.PageWorkSpaceDTO;
import com.ruoyi.ly.domain.vo.PageProjectVO;
import com.ruoyi.ly.domain.vo.PageWorkSpaceVO;
import com.ruoyi.ly.domain.vo.TreeChildrenVO;
import com.ruoyi.ly.domain.vo.WorkSpaceDetailVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WorkSpaceMapper {

    //分页查询
    Page<PageWorkSpaceVO> pageQuery(PageWorkSpaceDTO pageWorkSpaceDTO);

    //工作区删除
    @Delete("delete from space_site_group where site_group_id = #{siteGroupId}")
    void delete(Long siteGroupId);

    //创建工作区
    void insert(SpaceSiteGroup spaceSiteGroup);

    //根据工作区siteGroupId查询楼栋
    // @Select("select* from space_site_group where site_group_id = #{siteGroupId}")
    WorkSpaceDetailVO selectById(Long siteGroupId);

    //更新工作区
    void update(SpaceSiteGroup spaceSiteGroup);

    //查询所有工作区
    @Select("select site_group_name as name,site_group_id as id,1 as type from space_site_group where floor_number = #{floorNumber} and ban_id = #{banID}")
    List<TreeChildrenVO> selectAllWorkSpace(@Param("floorNumber") Long floorNumber, @Param("banID") Long banID);
}
